<?php

/**
 * 导航管理
 * @author 陈德本
 *
 */
class navService extends commonService
{

    /**
     *
     * @var navDao
     */
    protected $pao;

    public function __construct()
    {
        parent::__construct();
        $this->pao = InitPHP::getDao("nav");
    }

    /**
     * 获取导航
     *
     * @param bool|string $tree
     *            是否返回Tree
     * @param int $status
     *            $status=2表示获取所有导航，$status=1表示获取未禁用导航，$status=0表示获取已禁用导航
     * @return Ambigous <multitype:, multitype:array , boolean, multitype:multitype: >
     */
    public function getNav($tree = TRUE, $status = 2)
    {
        if ($status == 2) {
            $data = $this->pao->getAllByMutiple();
        } else {
            $data = $this->pao->getAllByMutiple(array(
                'status' => $status
            ));
        }
        if ($tree) {
            $data = list_to_tree($data, "id", "pid", "sub");
        }
        return $data;
    }
}